package com.snoob.springCloudGateway.filter.gatewayFiler.requestParams;

import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

/**
 * @描述: TODO 请求参数网关过滤器工厂，需要为相关路由配置上才可生效
 * @作者: lixing
 * @日期 2021/6/24 10:25
 */
@Component
public class MyRequestParamsGatewayFilterFactory extends AbstractGatewayFilterFactory<MyRequestParamsGatewayFilterFactoryConfig> {
    /*
     * 构造函数
     */
    public MyRequestParamsGatewayFilterFactory() {
        super(MyRequestParamsGatewayFilterFactoryConfig.class);
    }

    /*
     * 自定义配置类-内部类，用于传入配置参数
     */
    @Override
    public List<String> shortcutFieldOrder() {
        return Arrays.asList("isPrint","isDecrypt");
    }

    /*
     * 过滤器逻辑
     */
    @Override
    public GatewayFilter apply(MyRequestParamsGatewayFilterFactoryConfig config) {
        return new MyRequestParamsGatewayFilter(config);
    }

}
